package mju.cxf.handler;

import lombok.extern.slf4j.Slf4j;
import mju.cxf.exception.CaptchaException;
import mju.cxf.exception.LoginFailedException;
import mju.cxf.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//用户异常处理器
@RestControllerAdvice
@Slf4j
public class UserExceptionHandler {
    @ExceptionHandler(CaptchaException.class)
    public Result<String> IoHandler(CaptchaException ex){
        return Result.error(ex.getMessage());
    }
    @ExceptionHandler(LoginFailedException.class)
    public Result<String> LoginHandler(LoginFailedException ex){
        return Result.error(ex.getMessage());
    }
}
